<?php
/**
 * @version 	$Id: fForm.class.php 74 2010-03-17 06:48:21Z mylifeisskidrow@gmail.com $
 * @author 		$Author: mylifeisskidrow@gmail.com $
 * @copyright 	Copyright (c) 2010 Luu Trong Hieu. All right reserved.
 * @license 	GNU/GPL see license.php
 */

defined('IN_FLYWHEEL') or die('Restricted Access!');

/**
 * Form
 * 
 * @package 	system
 * @subpackage 	form
 *
 */
class fForm {
	
	protected static $instance;
	
	private $name;
	
	private $method;
	
	private $isCsrfProtection = true;
	
	private $action = null;
	
	private $elements = array();
	
	public function __construct($name, $action = '', $method = 'POST') {
		$this->name = $name;
		$this->method = $method;
		$this->action = $action;	
	}	
	
	/**
	 * Set Is Cross-site request force protection
	 *
	 * @param boolean $b
	 */
	public function setCsrfProtection($b) {
		$this->isCsrfProtection = (boolean) $b;
	}
	
	/**
	 * Create Cross Site Form Protection
	 *
	 * @return string
	 */
	public static function renderCsrfProtection() {
		$token = fFactory::getSession()->getToken();		
		return '<input name="' .$token .'" value="1" type="hidden" />';					
	}
}